﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Admin_Login" EnableSessionState="True" %>
<%@ Import Namespace="NTTHAO.CommonWeb" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title><%=LanguageUtility.GetLanguageText("ADMIN_SITE_TITLE", Session)%></title>
	<meta http-equiv="X-UA-Compatible" content="IE=IE8" />
    <meta http-equiv="CACHE-CONTROL" content="NO-CACHE" />
    <meta http-equiv="PRAGMA" content="NO-CACHE" />
    <meta http-equiv="EXPIRES" content="<%=DateTime.Now.AddMinutes(10).ToString() %>" />
    <meta name="GOOGLEBOT" content="NOARCHIVE" />
    <meta name="AUTHOR" content="ThaoNguyen" />
    <meta name="COPYRIGHT" content="&copy; 2008 ThaoNguyen" />
    <meta name="ROBOTS" content="NONE" />
    <link rel="Shortcut Icon" href="resources/images/favico.ico" type="image/x-icon" />
	<link rel="stylesheet" type="text/css" href="resources/css/admin.css" /> 
    <script type="text/javascript" src="resources/js/yui/utilities/utilities.js"></script>
	<script type="text/javascript" src="Resources/js/md5/md5.js" ></script>
	<script type="text/javascript" src="Resources/js/custom/check.js" ></script>
    <script type="text/javascript" src="Resources/js/custom/ntthao.js"></script>
<style type="text/css">
html, body { height: 100%; }
body { min-height: 350px; }
</style>
<script type="text/javascript">
function onWindowResize() {
    if ( typeof(window.top) != 'undefined' && typeof(window.top.onFrameChanged) == 'function') {
        
        var frameData = window.top.document.getElementById('frameData');
        if (frameData != null) {
            frameData.height = '1px';
        }

        window.top.onFrameChanged();
        //window.top.onFrameChanged();
    }
}

YAHOO.util.Event.on(window, "load", onWindowResize);

    NTTHAO.namespace('page');

    NTTHAO.page.langText = [];
    NTTHAO.page.langText['BLANK_USERNAME'] = '<%=LanguageUtility.GetLanguageText("BLANK_USERNAME", Session)%>';
    NTTHAO.page.langText['INVALID_USERNAME_2'] = '<%=LanguageUtility.GetLanguageText("INVALID_USERNAME_2", Session)%>';
    NTTHAO.page.langText['BLANK_PASSWORD'] = '<%=LanguageUtility.GetLanguageText("BLANK_PASSWORD", Session)%>';
    NTTHAO.page.langText['INVALID_PASSWORD_2'] = '<%=LanguageUtility.GetLanguageText("INVALID_PASSWORD_2", Session)%>';

	function checkSubmit(form)
	{
		var errorMessage = "";
	
		errorMessage = CheckFieldString("noblank", form.txtusername, NTTHAO.page.langText['BLANK_USERNAME']);
		if(errorMessage != "")
		{
			showError(errorMessage);
			form.txtusername.select();
			form.txtusername.focus();
			return false;
		}

		errorMessage = CheckFieldString("noblank", form.txtpassword, NTTHAO.page.langText['BLANK_PASSWORD']);
		if(errorMessage != "")
		{
			showError(errorMessage);
			form.txtpassword.select();
			form.txtpassword.focus();
			return false;
		}
	
		errorMessage = CheckFieldString("alphanum", form.txtusername, NTTHAO.page.langText['INVALID_USERNAME_2']);
		if(errorMessage != "")
		{
			showError(errorMessage);
			form.txtusername.focus();
			form.txtusername.select();
			return false;
		}
		
		errorMessage = CheckFieldString("alphanum", form.txtpassword, NTTHAO.page.langText['INVALID_PASSWORD_2']);
		if(errorMessage != "")
		{
			showError(errorMessage);
			form.txtpassword.select();
			form.txtpassword.focus();
			return false;
		}
		
		var txtchallenge = document.getElementById("txtchallenge").value;
		var strPw = hex_md5(hex_md5(document.getElementById("txtpassword").value) + txtchallenge);
		document.getElementById("txtpasswordencoded").value = strPw;
		
		return true;
	}
	
	function showError(strMessage)
	{
		document.getElementById('errmsg').innerHTML = strMessage;
	}
</script>
</head>
<body>
<table cellspacing="0" cellpadding="0" width="100%" border="0" height="100%" style="font-size: 8pt;">
	<tr valign="middle">
		<td align="center" style="background-color:#0040c0;" valign="middle">
			<form id="frmLogin" method="post" onsubmit="return checkSubmit(this);" runat="server" >
			<input type="hidden" id="txtchallenge" name="txtchallenge" value="<%=this._ChallengeString %>"/>&nbsp;
			<input type="hidden" id="txtpasswordencoded" name="txtpasswordencoded" value=""/>
			<div style="font-family: Times New Roman; font-size: 18pt; font-weight:bold; color: White; display: none;"><%=LanguageUtility.GetLanguageText("ADMIN_SITE_TITLE", Session)%></div>
			&nbsp;&nbsp;
			<table cellspacing="0" cellpadding="0" width="350" border="0">
				<tr>
					<td width="1"><img height="39" src="Resources/images/box_log_01.gif" width="18" alt="" /></td>
					<td align="center" style="background: url(Resources/images/box_log_02.gif); font-weight:bold"><img src="Resources/images/contents.gif" height="9" width="324"/></td>
					<td width="1"><img alt="" height="39" src="Resources/images/box_log_03.gif" width="17" /></td>
				</tr>
				<tr>
					<td style="background: url(Resources/images/box_log_08.gif);"><img alt="" height="2" src="Resources/images/box_log_08.gif" width="18" /></td>
					<td align="center" style="background-color:#ffffff;">
						<table cellspacing="0" cellpadding="3" width="280" border="0" style="font-size: 8pt;">
							<tr>
								<td colspan="2" height="20px">
								</td>
							</tr>
							<tr>
								<td><%=LanguageUtility.GetLanguageText("USERNAME", Session)%>:</td>
								<td>
									<input enableviewstate="true" type="text" style="width:200px" id="txtusername" name="txtusername" value="" />
								</td>
							</tr>
							<tr>
								<td><%=LanguageUtility.GetLanguageText("PASSWORD", Session)%>:</td>
								<td>
									<input type="password" style="width:200px" id="txtpassword" name="txtpassword" value="" />													
								</td>
							</tr>
							<tr>
								<td>&nbsp;</td>
								<td>
                                    <asp:ImageButton ID="LoginButton" runat="server" ImageUrl="Resources/images/btn_Login_En.gif" OnClick="LoginButton_Click" />
                                    </td>
							</tr>
							<tr>
								<td colspan="2" height="5">
								</td>
							</tr>
							<tr>
								<td colspan="2" align="center">
									<div id="errmsg" style="color:#FF0000; min-height:15px;"><%=this._ErrorString %></div>
								</td>
							</tr>
					  </table>
				  </td>
					<td style="background:url(Resources/images/box_log_04.gif);"><img alt="" height="3" src="Resources/images/box_log_04.gif" width="17" /></td>
				</tr>
				<tr>
					<td><img alt="" height="23" src="Resources/images/box_log_07.gif" width="18" /></td>
					<td style="background:url(Resources/images/box_log_06.gif)"><img alt="" height="23" src="Resources/images/box_log_06.gif" width="3" /></td>
					<td><img alt="" height="23" src="Resources/images/box_log_05.gif" width="17" /></td>
				</tr>
			</table>
			</form>
		</td>
	</tr>
	<tr>
		<td height="27"align="center">
		    <div id="footer"><span>Best view: <b>Chrome, Firefox, Safari 5.</b> Compatible: IE8.</span></div>
		</td>
	</tr>
</table>
<script type="text/javascript">
    document.getElementById('txtusername').focus();
</script>
</body>
</html>
